libxl: actually abort if initializing a ctx's lock fails
authorMatthew Daley <mattd@bugfuzz.com>
Sun, 1 Dec 2013 10:15:00 +0000 (23:15 +1300)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Mon, 2 Dec 2013 12:02:58 +0000 (12:02 +0000)
If initializing the ctx's lock fails, don't keep going, but instead
error out.

Coverity-ID: 1055289
Signed-off-by: Matthew Daley <mattd@bugfuzz.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/libxl.c

index 2b847eff8868870f88d999b13670bcd8ff23ab40..26eaee48410ab679f620db0f0363022572634610 100644 (file)
@@ -74,6 +74,8 @@ int libxl_ctx_alloc(libxl_ctx **pctx, int version,
         LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Failed to initialize mutex");
         free(ctx);
         ctx = 0;
+        rc = ERROR_FAIL;
+        goto out;
     }
 
     /* Now ctx is safe for ctx_free; failures simply set rc and "goto out" */